package jeuDeLaVieTest;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import jeuDeLaVie.Cellule;

public class CelluleTest {

	private Cellule cellule;

	public CelluleTest() {
	}

	@Before
	public void setUp() throws Exception {
		cellule = new Cellule(1,2);
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testCellule() {
		cellule = new Cellule(1,2);
		assertEquals(cellule.getAbs(),1);
		assertEquals(cellule.getOrd(),2);
	}

	
	@Test
	public void testEquals() {
		assertTrue(cellule.equals(cellule));
		assertTrue(cellule.equals(new Cellule(1,2)));
		assertFalse(cellule.equals(new Cellule(3,2)));
		assertFalse(cellule.equals(new Cellule(1,1)));
		assertFalse(cellule.equals(4));
	}

	@Test
	public void testCompareTo() {
		Cellule d =new Cellule(0,4);
		Cellule e = new Cellule(1,1);
		assertEquals(cellule.compareTo(d),1);
		assertEquals(cellule.compareTo(e),1);
		assertEquals(cellule.compareTo(cellule),0);
		assertEquals(cellule.compareTo(new Cellule(1,2)),0);
		assertEquals(d.compareTo(cellule),-1);
		assertEquals(e.compareTo(cellule),-1);		
		assertEquals(cellule.compareTo(null),1);
	}

}
